const express = require('express')
const router = express.Router()

router.post('/sign',(req,res)=>{
    let bodyOjb = req.body
    if(bodyOjb.uname && bodyOjb.upwd){
        req.session.logined=true
        req.session.loginUser = bodyOjb
        res.redirect('/')
    }else{
        res.render('index',{user:null})
    }
})


router.get('/login',(req,res)=>{
    res.render('login')
})


module.exports = router